package com.xigua.JucOfBeautiful.chapterOne.interrup1_7;

/**
 * @author LiRongHua
 * @Title: ${file_name}
 * @Package ${package_name}
 * @Description: ${todo}
 * @date 2022/1/2314:30
 */
public class InterupTest {

    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(()->{
           while (!Thread.currentThread().isInterrupted()){
               System.out.println(Thread.currentThread()+" hello");
           }
        });
        thread.start();
        Thread.sleep(1);
        System.out.println("main thread interrupt thread");
        thread.interrupt();

        thread.join();
        System.out.println("mian is over");
    }

}
